<template>
    <div class="list">
        <li
            class="item"
            v-for="item in letters"
            :key="item"
            @click="handleLetterClick"
            :ref="item"
            
        >
            {{ item }}
        </li>
    </div>
</template>

<script>
export default {
    name: "CityAlphabet",
    props: {
        cities: Object,
    },
    data() {
        return {
            // touchStatus: "",
            // startY: ''
        };
    },
    computed: {
        letters() {
            const letters = [];
            for (let i in this.cities) {
                letters.push(i);
            }
            return letters;
        },
    },
    methods: {
        handleLetterClick(e) {
            this.$emit("change", e.target.innerText);
        },
        // handleTouchStart() {
        //     this.touchStatus = true;
        // },
        // handleTouchMove(e) {
        //     let arr = [];
        //     if (this.touchStatus) {
        //         for (let i in this.cityList) {
        //             arr.push(i);
        //         }
        //         let startY = e.touches[0].clientY;
        //         const index = Math.floor((startY - 170) / 18.5);
        //         if (index >= 0 && index <= 21) {
        //             this.$emit("changeAlpha", arr[index]);
        //         }
        //     }
        // },
        // handleTouchEnd() {
        //     this.touchStatus = false;
        // },
    },
};
</script>

<style scoped>
.list {
    position: absolute;
    right: 0;
    top: 1.58rem;
    bottom: 0;
    width: 0.4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.list li {
    list-style: none;
    line-height: 0.4rem;
    text-align: center;
    color: #00bcd4;
}
</style>